﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace VNAManagebank
{
    public partial class Main : Form
    {
        #region Khai Báo
        bool checkClose = false;
        #endregion

        public Main()
        {
            InitializeComponent();
        }

        private void Main_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
                case Keys.Escape:
                    Thoat();
                    break;
                default:
                    break;
            }
        }

        #region nghiệp Vụ
        void Thoat()
        {
            checkClose = true;
            if (MessageBox.Show(Common.MSG.MSG1(), Common.MSG.TieuDe, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
            {
                Application.Exit();
            }
        }
        #endregion

        private void Main_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!checkClose)
            {
                if (MessageBox.Show(Common.MSG.MSG1(), Common.MSG.TieuDe, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                {
                    checkClose = true;
                    Application.Exit();
                }
                else
                {
                    e.Cancel = true;
                }
            }
        }

        private void mnNhanVien_Click(object sender, EventArgs e)
        {
            new frmNhanVien().ShowDialog();
        }

        private void mnKhachHang_Click(object sender, EventArgs e)
        {

        }
    }
}
